package com.dendi.springcloud.consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.config.environment.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by sang on 2017/9/4.
 */
@RestController
public class ConsumerController {
    @Autowired
    RestTemplate restTemplate;

    @Value("${neo.hello}")
    String sang;
//    @Autowired
//    Environment env;
    @RequestMapping(value = "/consumer",method = RequestMethod.GET)
    public String helloController() {
        System.out.println("sang"+sang);
        return restTemplate.getForEntity("http://HELLO-SERVICE/hello", String.class).getBody();
    }
}
